﻿using System;
using System.ComponentModel;
using System.Globalization;
using AMatysiak.Methods;

namespace AMatysiak.Converters
{
    public class CurrencyConverter : DoubleConverter
    {
        public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destType)
        {
            return ((double)value).ToString("C");
        }

        public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
        {
            return value.ToString().ToDouble();
        }
    }
}
